package com.wsfk.ssm.entity;

import java.util.UUID;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

public class Picture {

	public final static String ICON = "icon";
	public final static String CONTENT = "content";
	
	private String id;
	private String type;		//图片类型
	private String fileDir;		//图片地址
	private String handBookId;	//对应手册的ID
	
	
	
	public Picture() {
		super();
		
	}
	public Picture(String id, String type, String fileDir, String handBookId) {
		super();
		this.id = id;
		this.type = type;
		this.fileDir = fileDir;
		this.handBookId = handBookId;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getFileDir() {
		return fileDir;
	}
	public void setFileDir(String fileDir) {
		this.fileDir = fileDir;
	}
	public String getHandBookId() {
		return handBookId;
	}
	public void setHandBookId(String handBookId) {
		this.handBookId = handBookId;
	}
	
	@Override
	public String toString() {
		return "Picture [id=" + id + ", type=" + type + ", fileDir=" + fileDir
				+ ", handBookId=" + handBookId + "]";
	}
	 @Override
	public boolean equals(Object obj) {
		 Picture out = (Picture) obj;
		return new EqualsBuilder()
		.append(this.fileDir, out.fileDir)
		.append(this.handBookId, out.handBookId)
		.append(this.type, out.type)
		.isEquals();
	}
	
	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}
	public static Picture getInstance(String bookid, String path) {
		Picture picture = new Picture();
		picture.setId(UUID.randomUUID().toString());
		picture.setType(Picture.CONTENT);
		picture.setHandBookId(bookid);
		picture.setFileDir(path);
		return picture;
	}
	
	
}
